const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('as4KDotsBaseProfile', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "编号"
    },
    hold_focus: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "集中度"
    },
    people_avg_hold_shares: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: 0,
      comment: "人均持股"
    },
    stock_code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      comment: "代码"
    },
    stock_name: {
      type: DataTypes.STRING(30),
      allowNull: true,
      comment: "名字"
    },
    tc_name: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      defaultValue: "",
      comment: "核心题材"
    },
    selected_board_reason: {
      type: DataTypes.STRING(5000),
      allowNull: true,
      defaultValue: "",
      comment: "入选原因"
    },
    company_type: {
      type: DataTypes.STRING(200),
      allowNull: true,
      comment: "公司类型"
    },
    company_url: {
      type: DataTypes.STRING(256),
      allowNull: false,
      comment: "公司简介"
    },
    done: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      defaultValue: 0,
      comment: "处理状态"
    },
    company_name: {
      type: DataTypes.STRING(500),
      allowNull: true,
      comment: "公司名字"
    },
    main_business: {
      type: DataTypes.STRING(500),
      allowNull: true,
      comment: "主营业务"
    },
    freehold_ratio_total: {
      type: DataTypes.DECIMAL(50,2),
      allowNull: true,
      defaultValue: 0.00,
      comment: "流通股东持股"
    },
    datetime: {
      type: DataTypes.STRING(10),
      allowNull: true
    },
    end_date: {
      type: DataTypes.STRING(100),
      allowNull: true,
      defaultValue: "",
      comment: "统计日期"
    },
    holder_total_num: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: 0,
      comment: "股东人数"
    },
    price_ave: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: true,
      defaultValue: 0.00,
      comment: "均价"
    },
    hold_ratio_total: {
      type: DataTypes.DECIMAL(50,2),
      allowNull: true,
      defaultValue: 0.00,
      comment: "十大股东持股"
    },
    total_num_ratio: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "人数较上期变化"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    }
  }, {
    sequelize,
    tableName: 'as4k_dots_base_profile',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
      {
        name: "com_base_profile_stock_code_index",
        using: "BTREE",
        fields: [
          { name: "stock_code" },
        ]
      },
      {
        name: "index_name",
        using: "BTREE",
        fields: [
          { name: "stock_name" },
        ]
      },
    ]
  });
};
